package method.method1203;

import java.util.Scanner;

//评委打分  键盘输入10个数 去掉最大和最小求均值
public class demo02 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请依次输入十位评委的打分：");
        int[] arr=new int[10];
        for (int i = 0; i < arr.length; i++) {
            int num =sc.nextInt();
            if (num>=0&&num<=100){
                arr[i]=num;
            }else{
                System.out.println("此数输入有误，请核对后再次输入：");
            }
        }
        int max=arr[0];
        int min=arr[0];
        int count=arr[0];
        for (int i = 1; i < arr.length; i++) {
            count+=arr[i];
            if (arr[i]>=max){
                max=arr[i];
            }
            if (arr[i]<=min){
                min=arr[i];
            }
        }
        System.out.println((count-max-min)/(arr.length-2.0));
    }
}
